package lesson2.example1;

/*
abstract class JCTree{
	public abstract void accept(JCTreeVisitor v);
}
abstract class JCExpression extends JCTree{}
class JCUnary extends JCExpression{
	public void accept(JCTreeVisitor visitor){
		visitor.visitJCUnary(this);
	}
}
class JCBinary extends JCExpression{
	public void accept(JCTreeVisitor visitor){
		visitor.visitJCBinary(this);
	}
}
class JCAssign extends JCExpression{
	public void accept(JCTreeVisitor visitor){
		visitor.visitJCAssign(this);
	}
}


abstract class JCTreeVisitor{
	public void visitTree(JCTree tree){
		// error
	}
	public void visitJCUnary(JCUnary tree){
		visitTree(tree);
	}
	public void visitJCBinary(JCBinary tree){
		visitTree(tree);
	}
	public void visitJCAssign(JCAssign tree){
		visitTree(tree);
	}
}

// 打印抽象语法树
class Pretty extends JCTreeVisitor{
	public void visitJCUnary(JCUnary tree){
		// 对一元表达式进行打印
	}
	public void visitJCBinary(JCBinary tree){
		// 对二元表达式进行打印
	}
	public void visitJCAssign(JCAssign tree){
		// 对赋值表达式进行打印
	}
}

public class TestVisitor{
	public void test(JCTree ast){
		ast.accept(new Pretty());
	}
}
*/

